package cn.com.service.impl;

import org.springframework.mail.SimpleMailMessage;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import cn.com.mapper.UserInfoMapper;
import cn.com.beans.UserInfo;
import cn.com.service.UserInfoService;

import java.util.List;
import java.util.Random;

@Service
public class UserInfoServiceImpl implements UserInfoService {

    @Resource
    private UserInfoMapper userInfoMapper;

    @Override
    public boolean selectByemail(String email) {
        List<UserInfo> userInfos = userInfoMapper.selectByEmail(email);
        System.out.println("userInfos = " + userInfos);
        if(userInfos.size() > 0) {
            return true;
        }
        return false;
    }

    @Override
    public int deleteByPrimaryKey(Integer uId) {
        return userInfoMapper.deleteByPrimaryKey(uId);
    }

    @Override
    public boolean insert(UserInfo userInfo) {
        boolean b = userInfoMapper.insert(userInfo) > 0;
        return b;
    }

    @Override
    public int insertSelective(UserInfo record) {
        return userInfoMapper.insertSelective(record);
    }

    @Override
    public UserInfo selectByPrimaryKey(Integer uId) {
        return userInfoMapper.selectByPrimaryKey(uId);
    }

    @Override
    public int updateByPrimaryKeySelective(UserInfo record) {
        return userInfoMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(UserInfo userInfo) {
        return userInfoMapper.updateByPrimaryKey(userInfo);
    }

    @Override
    public int updateByAid(Integer aid) {
        int i = userInfoMapper.updateByaid(aid);
        return userInfoMapper.updateByaid(aid);
    }
}


